package org.example.spring.controller.User;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.spring.domain.pojo.Result;
import org.example.spring.domain.pojo.Flower;
import org.example.spring.service.FlowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController("userFlowerController")
@RequestMapping("/user/flower")
@Api(tags = "花卉相关接口")
public class FlowerController {

    @Autowired
    private FlowerService flowerService;

    @ApiOperation(value = "获取花卉图片渲染轮播图")
    @RequestMapping("/getFlowerImageBanner")
    public Result<ArrayList<String>> getFlowerImageBanner() {
        return flowerService.getFlowerImageBanner();
    }

    @ApiOperation(value = "获取热门花卉")
    @RequestMapping("/getHotFlower")
    public Result<ArrayList<Flower>> getHotFlower() {
        return flowerService.getHotFlower();
    }

    @ApiOperation(value = "新品花卉")
    @RequestMapping("/getNewFlower")
    public Result<ArrayList<Flower>> getNewFlower() {
        return flowerService.getNewFlower();
    }

    @ApiOperation(value = "获取所有花卉")
    @RequestMapping("/getAllFlower")
    public Result<ArrayList<Flower>> getAllFlower() {
        ArrayList<Flower> flowers = flowerService.getAllFlower();
        return Result.success(flowers);
    }

    @ApiOperation(value = "获取花卉详情")
    @GetMapping("/getFlowerById")
    public Result<Flower>getFlowerById(@RequestParam  Integer flowerId){
        Flower flowers = flowerService.getFlowerById(flowerId);
        return Result.success(flowers);
    }

}
